package com.diver.flinkdemo.entity.Trd.hsgh;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author zhangyj
 * @date 2022/11/22
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class HsghResult<T> {

    private Integer code;
    private String msg;
    private T data;

    public static <T> HsghResult<T> getInstance(Integer code, String msg, T data){
        return new HsghResult<T>(code,msg,data);
    }

    public static <T> HsghResult <T> getInstance(){
        return new HsghResult<T>();
    }

    public static <T> HsghResult<T> getSuccessInstance(T data){
        return getInstance(200,"success",data);
    }

    /**
     * 业务异常
     * @param <T>
     * @return
     */
    public static <T> HsghResult<T> getBusinessErrorInstance(String msg){
        return getInstance(201,msg,null);
    }

    public static <T> HsghResult<T> getErrorInstance(){
        return getInstance(400,"fail",null);
    }

    //未绑定学生证
    public static <T> HsghResult<T> getNotBindStudentCardInstance(){
        return getInstance(202,"未绑定学生证",null);
    }

    //手机号与监护人手机号不一致
    public static <T> HsghResult<T> getNotMatchPhoneInstance(){
        return getInstance(203,"与绑定的监护人手机号不匹配",null);
    }

    //不是黄石专版
    public static <T> HsghResult<T> getIsNotHSVersion(){
        return getInstance(201,"卡片版本不支持",null);
    }

    //未开通会员
    public static <T> HsghResult<T> getNotHaveMember(){
        return getInstance(204,"未绑定会员码，请先绑定！",null);
    }

}
